package org.ocelot.tunes4j.beans;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;

public class AudioObject  {
	
	private int id;
	private String path;
	private String fileName;
	private String artist;
	private String title;
	private String album;
	private String trackNumber;
	private String genre;
	private String author;
	private String year;
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public String getArtist() {
		return artist;
	}
	public void setArtist(String artist) {
		this.artist = artist;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getAlbum() {
		return album;
	}
	public void setAlbum(String album) {
		this.album = album;
	}
	public String getTrackNumber() {
		return trackNumber;
	}
	public void setTrackNumber(String trackNumber) {
		this.trackNumber = trackNumber;
	}
	public String getGenre() {
		return genre;
	}
	public void setGenre(String genre) {
		this.genre = genre;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String toString() {
		try {
			return BeanUtils.describe(this).toString();
		} catch (Exception e) {
			System.out.println("Error converting object to String" + e.toString());
			e.printStackTrace();
		}
		return super.toString();
	}
	

	

	@Override
	public boolean equals(final Object other) {
		if (!(other instanceof AudioObject))
			return false;
		AudioObject castOther = (AudioObject) other;
		return new EqualsBuilder().append(id, castOther.id).append(path,
				castOther.path).append(fileName, castOther.fileName).append(
				artist, castOther.artist).append(title, castOther.title)
				.append(album, castOther.album).append(trackNumber,
						castOther.trackNumber).append(genre, castOther.genre)
				.append(author, castOther.author).append(year, castOther.year)
				.isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder(17, 37).append(id).append(path).append(
				fileName).append(artist).append(title).append(album).append(
				trackNumber).append(genre).append(author).append(year)
				.toHashCode();
	}



}
